package com.ruoyi.consumables.service.impl;

import java.util.List;
import java.util.Random;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumables.mapper.ApplyRecordMapper;
import com.ruoyi.consumables.domain.ApplyRecord;
import com.ruoyi.consumables.service.IApplyRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 申请记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-22
 */
@Service
public class ApplyRecordServiceImpl implements IApplyRecordService 
{
    @Autowired
    private ApplyRecordMapper applyRecordMapper;

    /**
     * 查询申请记录
     * 
     * @param applyRecordId 申请记录主键
     * @return 申请记录
     */
    @Override
    public ApplyRecord selectApplyRecordByApplyRecordId(Long applyRecordId)
    {
        return applyRecordMapper.selectApplyRecordByApplyRecordId(applyRecordId);
    }

    /**
     * 查询申请记录列表
     * 
     * @param applyRecord 申请记录
     * @return 申请记录
     */
    @Override
    public List<ApplyRecord> selectApplyRecordList(ApplyRecord applyRecord)
    {
        return applyRecordMapper.selectApplyRecordList(applyRecord);
    }

    /**
     * 新增申请记录
     * 
     * @param applyRecord 申请记录
     * @return 结果
     */
    @Override
    public int insertApplyRecord(ApplyRecord applyRecord)
    {
        applyRecord.setCreateTime(DateUtils.getNowDate());
        return applyRecordMapper.insertApplyRecord(applyRecord);
    }

    /**
     * 修改申请记录
     * 
     * @param applyRecord 申请记录
     * @return 结果
     */
    @Override
    public int updateApplyRecord(ApplyRecord applyRecord)
    {
        applyRecord.setUpdateTime(DateUtils.getNowDate());
        return applyRecordMapper.updateApplyRecord(applyRecord);
    }

    /**
     * 批量删除申请记录
     * 
     * @param applyRecordIds 需要删除的申请记录主键
     * @return 结果
     */
    @Override
    public int deleteApplyRecordByApplyRecordIds(String applyRecordIds)
    {
        return applyRecordMapper.deleteApplyRecordByApplyRecordIds(Convert.toStrArray(applyRecordIds));
    }

    /**
     * 删除申请记录信息
     * 
     * @param applyRecordId 申请记录主键
     * @return 结果
     */
    @Override
    public int deleteApplyRecordByApplyRecordId(Long applyRecordId)
    {
        return applyRecordMapper.deleteApplyRecordByApplyRecordId(applyRecordId);
    }
}
